#include "TrainingSample.h"
#include "Helper.h"

using namespace NeuralPlusPlus::Core;

NeuralPlusPlus::Core::TrainingSample::TrainingSample( double* inputVector, int inputVectorLength, double* outputVector , int outputVectorLength)
	{
	Helper::ValidateNotNull(inputVector, "inputVector");
	Helper::ValidateNotNull(outputVector, "outputVector");

	this->InputVector = new double[inputVectorLength];
	this->OutputVector = new double[outputVectorLength];
	memcpy(this->InputVector, inputVector, sizeof(double) * inputVectorLength);
	memcpy(this->OutputVector, outputVector, sizeof(double) * outputVectorLength);

	this->InputVectorLength = inputVectorLength;
	this->OutputVectorLength = outputVectorLength;
	this->NormalizedInputVectorLength = inputVectorLength;
	this->NormalizedOutputVectorLength = outputVectorLength;

	this->NormalizedInputVector = Helper::Normalize(inputVector, inputVectorLength);
	this->NormalizedOutputVector = Helper::Normalize(outputVector, outputVectorLength);
	}

NeuralPlusPlus::Core::TrainingSample::~TrainingSample()
	{
	delete[] InputVector;
	InputVector = NULL;
	InputVectorLength =0;
	delete[] OutputVector;
	OutputVector = NULL;
	OutputVectorLength =0;
	delete[] NormalizedInputVector;
	NormalizedInputVector = NULL;
	NormalizedInputVectorLength =0;
	delete[] NormalizedOutputVector;
	NormalizedOutputVector = NULL;
	NormalizedOutputVectorLength =0;
	}
